# 包含目录
include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/inc
    ${EIGEN3_INCLUDE_DIRS}
)

# 源文件
file(GLOB SOURCES 
"src/*.cpp" 
"src/eigen/*.cpp" 
"src/vector/*.cpp"
"src/tools/*.cpp"
"src/autograd/*.cpp"
)

# 创建库
add_library(learn_deep_learning SHARED 
    ${SOURCES}
)

# 链接库
target_link_libraries(learn_deep_learning PUBLIC TBB::tbb OpenMP::OpenMP_CXX)

# 设置属性
set_target_properties(learn_deep_learning PROPERTIES
    VERSION 1.0.0
    SOVERSION 1
    OUTPUT_NAME "learn_deep_learning"
)

# Windows导出符号
if(WIN32)
    target_compile_definitions(learn_deep_learning PRIVATE LEARN_DEEP_LEARNING_EXPORTS)
endif()

target_compile_definitions(learn_deep_learning PRIVATE _LIBCPP_ENABLE_PARALLEL_ALGORITHMS=1)


# 安装规则
install(TARGETS learn_deep_learning
    ARCHIVE DESTINATION lib
    LIBRARY DESTINATION lib
    RUNTIME DESTINATION bin
)

install(DIRECTORY inc/ DESTINATION include
    FILES_MATCHING PATTERN "*.h"
)